/**
 * 消费习惯管理初始化
 */
var DistributiveDoctorLog = {
    id: "DistributiveDoctorLogTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1
};

/**
 * 初始化表格的列
 */
DistributiveDoctorLog.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: '', field: 'id', visible: false, align: 'center', valign: 'middle', width: '50px'},
        {title: 'TC姓名', field: 'tcName', align: 'center', valign: 'middle', sortable: true},
        {title: '分配医生', field: 'distributiveDoctor', align: 'center', valign: 'middle', sortable: true},
        {
            title: '分配时间', field: 'distributiveTime', align: 'center', valign: 'middle', sortable: true,
            formatter: function (value, row, index) {
                return value.substring(0, 19);
            }
        }
    ];
};

/**
 * 查询表单提交参数对象
 * @returns {{}}
 */
DistributiveDoctorLog.formParams = function () {
    var queryData = {};
    queryData['tcName'] = $("#tcName").val();
    queryData['distributiveDoctor'] = $("#distributiveDoctor").val();
    queryData['startTime'] = $("#startTime").val();
    queryData['endTime'] = $("#endTime").val();
    return queryData;
}

DistributiveDoctorLog.resetSearch = function () {
    $("#tcName").val("");
    $("#distributiveDoctor").val("");
    $("#startTime").val("");
    $("#endTime").val("");
    DistributiveDoctorLog.search();
};

/**
 * 查询列表
 */
DistributiveDoctorLog.search = function () {
    DistributiveDoctorLog.table.refresh({query: DistributiveDoctorLog.formParams()});
};

$(function () {
    var defaultColunms = DistributiveDoctorLog.initColumn();
    var table = new BSTable(DistributiveDoctorLog.id, "/distributiveDoctorLog/list", defaultColunms);
    table.setPaginationType("server");
    table.setQueryParams(DistributiveDoctorLog.formParams());
    DistributiveDoctorLog.table = table.init();
    DistributiveDoctorLog.table = table;
});
